package com.village.friend.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.village.friend.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    User getUserByUserId(Integer uid, Double latitude, Double longitude);

    User getUserByUserMobile(String mobile, Double latitude, Double longitude);

    @Update("update user set  city = #{city},longitude = #{longitude},latitude = #{latitude}  where uid = #{uid}")
    Integer updateHeart(Integer uid, String city, Double longitude, Double latitude);

    @Update("update user set  vip_level = #{vipLevel},vip_end = #{vipEnd} where uid = #{uid}")
    Integer updateVipByUid(Integer uid, Integer vipLevel, LocalDateTime vipEnd);

    @Update("update user set  gender = #{gender},name = #{name} where uid = #{uid}")
    Integer updateGenderByUid(Integer uid, Integer gender, String name);

    @Update("update user set  gender = #{gender},name = #{name},parent = #{parent},invite_code = #{inviteCode} where uid = #{uid}")
    Integer updateGenderInviteByUid(Integer uid, Integer gender, String name, Integer parent, String inviteCode);

    Integer updateUserByUid(Integer uid, String name, String icon, String birth, Integer height, Integer weight, String photos, Integer isHide, Integer isFreeze, Integer isLogout, Integer vipLevel, String city, String selfDesc, String profession, String salaryYear, String weChatAccount, String flags);

    List<User> list(Integer uid, Integer gender, String city, Integer ageStart, Integer ageEnd, Integer heightStart, Integer heightEnd, String salaryYear, Double latitude, Double longitude, Integer offset, Integer limit, Integer mode);

    Integer listCount(Integer uid, Integer gender, String city, Integer ageStart, Integer ageEnd, Integer heightStart, Integer heightEnd, String salaryYear);


}
